<form action="/admin/product/package_group_price" method="post" id="sort_f">
<table id="" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1" data-operate-del="1" width="100%">
        <tbody data-listidx="0">
            <tr data-index="0">
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">产品名称</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <input type="hidden" name="id" value="{$tour.id}">
                    <input type="hidden" name="p_id" value="{$product.id}">
                    <input type="hidden" name="package_id" value="{$package_id}">
                    <input type="text" value="{$product.p_name}" disabled="disabled" class="form-control">
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">折扣</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <input type="text" name="discount" class="form-control" value="{$tour.discount}" id="discount">
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">淡旺季类型</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <select name="season_type" id="" class="form-control">
                        {volist name="type" id="r"}
                        <option value="{$key}" {if condition = '$tour.season_type eq $key'} selected='selected' {/if}>{$r}</option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">团期设置范围</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <input class="Wdate" type="text"  id="start" name="start" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd'})" value="{if $tour.start_time}{$tour.start_time|date='Y-m-d',###}{/if}" />-
                    <input class="Wdate" type="text"  id="end" name="end" onClick="WdatePicker({el:this,dateFmt:'yyyy-MM-dd'})" value="{if $tour.start_time}{$tour.end_time|date='Y-m-d',###}{/if}"/>
                </td>
            </tr>
           
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">同业是否享受折扣</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <input type="radio" id="ins0" name="industry_share" value="0" {if condition = '$tour.industry_share eq 0'}checked="checked"{/if}>
                    同业享受折扣
                    <input type="radio" id="ins1" name="industry_share" value="1" {if condition = '$tour.industry_share eq 1'}checked="checked"{/if}>
                    同业不享受折扣
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">同业佣金类型</td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <input type="radio" id="dis0" name="discounttype" value="0"  {if condition = '$tour.discounttype eq 0'}checked="checked"{/if}>
                    早鸟
                    <input type="radio" id="dis1" name="discounttype" value="1" {if condition = '$tour.discounttype eq 1'}checked="checked"{/if}>
                    闪电
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">旺季<input type="hidden" name="w_season[]" value="1" ></td>
                <td style="text-align: left; vertical-align: middle; width: 50%;">
                    <table cellpadding="0" cellspacing="0" border="1" class="table table-striped table-bordered table-hover" id="w_table">
                        <tr>
                            <th style="text-align: center; vertical-align: middle; width:5%; ">人数</th>
                            <th style="text-align: center; vertical-align: middle; width:10%;">单价</th>
                           
                            <th style="text-align: center; vertical-align: middle; width:60%;">文字说明</th>
                        </tr>
                      
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">2<input type="hidden" name="w_pnum[]" value="2" ></td>
                            <td><input type="text" name="tow_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['tow_num']}{/if}" ></td>
                            
                            <td><input type="text" name="tow_info[]" class="form-control" value="{if $tourprice}{$tourprice[0]['tow_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">3<input type="hidden" name="w_pnum[]" value="3" ></td>
                            <td><input type="text" name="three_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['three_num']}{/if}"></td>
                           
                            <td><input type="text" name="three_info[]" class="form-control" value="{if $tourprice}{$tourprice[0]['three_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">4<input type="hidden" name="w_pnum[]" value="4" ></td>
                            <td><input type="text" name="four_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['four_num']}{/if}" ></td>
                           
                            <td><input type="text" name="four_info[]" class="form-control"  value="{if $tourprice}{$tourprice[0]['four_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">5<input type="hidden" name="w_pnum[]" value="5" ></td>
                            <td><input type="text" name="five_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['five_num']}{/if}"></td>
                           
                            <td><input type="text" name="five_info[]" class="form-control" value="{if $tourprice}{$tourprice[0]['five_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">6<input type="hidden" name="w_pnum[]" value="6" ></td>
                            <td><input type="text" name="six_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['six_num']}{/if}"></td>
                          
                            <td><input type="text" name="six_info[]" class="form-control" value="{if $tourprice}{$tourprice[0]['six_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">7<input type="hidden" name="w_pnum[]" value="7" ></td>
                            <td><input type="text" name="seven_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[0]['seven_num']}{/if}"></td>
                           
                            <td><input type="text" name="seven_info[]" class="form-control" value="{if $tourprice}{$tourprice[0]['seven_info']}{/if}"></td>
                        </tr>
                    </table> 
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">淡季<input type="hidden" name="w_season[]" value="2" ></td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <table cellpadding="0" cellspacing="0" border="1" class="table table-striped table-bordered table-hover " id="d_table">
                        <tr>
                            <th style="text-align: center; vertical-align: middle; width:5%; ">人数</th>
                            <th style="text-align: center; vertical-align: middle; width:10%;">单价</th>
                          
                            <th style="text-align: center; vertical-align: middle; width:60%;">文字说明</th>
                        </tr>
                      
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">2<input type="hidden" name="d_pnum[]" value="2" ></td>
                            <td><input type="text" name="tow_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['tow_num']}{/if}"></td>
                          
                            <td><input type="text" name="tow_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['tow_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">3<input type="hidden" name="d_pnum[]" value="3" ></td>
                            <td><input type="text" name="three_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['three_num']}{/if}"></td>
                        
                            <td><input type="text" name="three_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['three_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">4<input type="hidden" name="d_pnum[]" value="4" ></td>
                            <td><input type="text" name="four_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['four_num']}{/if}"></td>
                           
                            <td><input type="text" name="four_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['four_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">5<input type="hidden" name="d_pnum[]" value="5" ></td>
                            <td><input type="text" name="five_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['five_num']}{/if}"></td>
                           
                            <td><input type="text" name="five_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['five_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">6<input type="hidden" name="d_pnum[]" value="6" ></td>
                            <td><input type="text" name="six_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['six_num']}{/if}"></td>
                         
                            <td><input type="text" name="six_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['six_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">7<input type="hidden" name="d_pnum[]" value="7" ></td>
                            <td><input type="text" name="seven_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[1]['seven_num']}{/if}"></td>
                       
                            <td><input type="text" name="seven_info[]" class="form-control" value="{if $tourprice}{$tourprice[1]['seven_info']}{/if}"></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="text-align: left; vertical-align: middle; width: 10%;padding-left: 50px;">平季<input type="hidden" name="w_season[]" value="3" ></td>
                <td style="text-align: left; vertical-align: middle; width: 90%;">
                    <table cellpadding="0" cellspacing="0" border="1" class="table table-striped table-bordered table-hover " id="p_table">
                        <tr>
                            <th style="text-align: center; vertical-align: middle; width:5%; ">人数</th>
                            <th style="text-align: center; vertical-align: middle; width:10%;">单价</th>
                           
                            <th style="text-align: center; vertical-align: middle; width:60%;">文字说明</th>
                        </tr>
                      
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">2<input type="hidden" name="p_pnum[]" value="2" ></td>
                            <td><input type="text" name="tow_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[2]['tow_num']}{/if}"></td>
                           
                            <td><input type="text" name="tow_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['tow_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">3<input type="hidden" name="p_pnum[]" value="3" ></td>
                            <td><input type="text" name="three_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[2]['three_num']}{/if}"></td>
                          
                            <td><input type="text" name="three_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['three_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">4<input type="hidden" name="p_pnum[]" value="4" ></td>
                            <td><input type="text" name="four_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[2]['four_num']}{/if}"></td>
                          
                            <td><input type="text" name="four_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['four_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">5<input type="hidden" name="p_pnum[]" value="5" ></td>
                            <td><input type="text" name="five_num[]" class="form-control change_price"  value="{if $tourprice}{$tourprice[2]['five_num']}{/if}"></td>
                          
                            <td><input type="text" name="five_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['five_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">6<input type="hidden" name="p_pnum[]" value="6" ></td>
                            <td><input type="text" name="six_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[2]['six_num']}{/if}"></td>
                         
                            <td><input type="text" name="six_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['six_info']}{/if}"></td>
                        </tr>
                        <tr>
                            <td style="text-align: center; vertical-align: middle; ">7<input  type="hidden" name="p_pnum[]" value="7" ></td>
                            <td><input type="text" name="seven_num[]" class="form-control change_price" value="{if $tourprice}{$tourprice[2]['seven_num']}{/if}"></td>
                            
                            <td><input type="text" name="seven_info[]" class="form-control" value="{if $tourprice}{$tourprice[2]['seven_info']}{/if}"></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="text-align: center; vertical-align: middle; ">
                </td>
                <td style="text-align: center; vertical-align: middle; ">
                    <button  class="btn btn-success btn-embossed" onclick="return windowsub()" style="float:left;width:100px;">确认提交</button>
                    <a href="/admin/product/group_package?pid={$p_id}&p_type=2" style="float: left; margin-left: 25px;" class="btn btn-success btn-embossed">返回上一步</a>
                </td>
            </tr>
        </tbody>
</table>
</form>
<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/WdatePicker.js"></script>
<style>
    .Wdate{
        height: 30px;
    }
</style>
<script>
    function windowsub() {
        var start = new Date($("#start").val());//开始时间
        var end = new Date($("#end").val());//结束时间
        if("Invalid Date" == start){
            alert("填写开始日期");
            return false;
        }
        if("Invalid Date" == end){
            alert("填写结束日期");
            return false;
        }
        // 有三种方法获取 如果获取的时间戳为13位那就不用除1000 否则就要除以1000
        var time1 = start.getTime()/1000;
        var time2 = end.getTime()/1000;
        var now_time = (new Date()).getTime()/1000;//当前时间戳
        if(time1 < now_time){
            alert("开始时间已过期，请重新选择开始团期");
            return false;
        }
        if(time1 > time2){
            alert("结束时间不能小于开始时间，请重新选择结束团期");
            return false;
        }
        var reg = /[^\d]/g;//不能为空只能是数字
        var discount = $('#discount').val();
        var childrenprice = $("#childrenprice").val();
        var onehouse = $("#onehouse").val();
        if(discount.replace(reg,"")==''){
            $('#discount').css('border-color','red');
            return false;
        }else {
            $('#discount').css('border-color','#aaa');
        }
        if(childrenprice.replace(reg,"")==''){
            $('#childrenprice').css('border-color','red');
            return false;
        }else {
            $('#childrenprice').css('border-color','#aaa');
        }
        if(onehouse.replace(reg,"")==''){
            $('#onehouse').css('border-color','red');
            return false;
        }else {
            $('#onehouse').css('border-color','#aaa');
        }
        var len = $(".change_price").length;
        for (var i = 0; i < len; i++) {
            if($(".change_price").eq(i).val().replace(reg,"") == ''){
                $(".change_price").eq(i).css("border","red solid 1px");
                return false;
            }else{
                $(".change_price").eq(i).css("border","#aaa solid 1px");
            }
        }
        $("#sort_f").submit();
    }
</script>